home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
081
/
addctrlz.arc
/
ADDCTRLZ.C
next >
Wrap
Text File
|
1987-08-10
|
2KB
|
83 lines
#include <ctype.h>
#include <dos.h>
#include <stdio.h>
main(argc,argv)
int argc;
char *argv[];
{
char cdir[32],dirname[32],drve,ex[100][13],sfl[100][13],propdir[32];
struct FIND *sys_files,*findmsg;
int cntt=0,count=0,excs=0,nn=0,scans,syst;
FILE *endmsg;
puts("\nAddCtrlZ [v0.0.0] - Simon Meldrum\n");
if (!(sys_files=findfirst("SYSTEM??.BBS",0xE7)))
{
puts("Can't find any SYSTEM??.BBS files.");
exit(1);
}
do
{
strcpy(sfl[cntt++],sys_files->name);
} while((sys_files=findnext()));
if (argc>1)
{
excs=argc-1;
do
{
strcpy(ex[count],"SYSTEM");
strcat(ex[count],argv[count+1]);
strcat(ex[count++],".BBS");
if (argv[count][0]=='0') strcpy(ex[count-1],"SYSTEM.BBS");
} while(count<excs);
}
getcwd(cdir,32);
do
{
scans=-1;
for(count=0;count<excs;count++)
{
if ((strcmp(ex[count],sfl[nn]))==0) scans=0;
}
syst=open(sfl[nn++],O_RDONLY);
lseek(syst,0x4L,0);
read(syst,dirname,32);
close(syst);
if (scans && (dirname[0]=='\\' || isalpha(dirname[0])))
{
drve=0;
if (dirname[0]!='\\')
{
drve=dirname[0];
rightcopy(propdir,dirname);
strcpy(dirname,propdir);
}
if (dirname[1]!=0) dirname[strlen(dirname)-1]=0;
chdir(dirname);
if ((findmsg=findfirst("*.MSG",0xE7)))
{
do
{
printf("%s\\%s\n",dirname,findmsg->name);
endmsg=fopen(findmsg->name,"a+b");
fseek(endmsg,0L,2);
putc(26,endmsg);
fclose(endmsg);
} while((findmsg=findnext()));
}
}
chdir(cdir);
} while(nn<cntt);
puts("\nAddCtrlZ completed...");
exit(0);
}
rightcopy(d,s)
char *d,*s;
{
while(*d++ = *(2+s++));
}